# check out https://solara.dev/ for documentation
# or https://github.com/widgetti/solara/
# And check out https://py.cafe/maartenbreddels for more examples
import solara
import pandas as pd
cats_and_dogs_df = pd.read_csv("https://data.sa.gov.au/data/datastore/dump/7e605073-57ac-4cb6-9a2b-a23054b4e66f?bom=True")
# reactive variables will trigger a component rerender
# when changed.
# When you change the default (now 0), hit the embedded browser
# refresh button to reset the state
clicks = solara.reactive(0)
@solara.component
def Page():
print("The component render function gets called")
# change this code, and see the output refresh
color = "green"
if clicks.value >= 5:
color = "red"
def increment():
clicks.value += 1
print("clicks", clicks) # noqa
solara.Button(label=f"Clicked: {clicks}", on_click=increment, color=color)
# Solara also supports ipywidgets
# remove the Page component and assign an ipywidget to
# the page variable, e.g.
# page = mywidget